<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>文档加载顺序</title>
		<!--方法二：添加onload事件-->
        <script>
			window.onload=function(){
				var oBtn=document.getElementById("btn");
				console.log(oBtn);
			}
		</script>
	</head>
	<body>
		<button id="btn">点我</button>
	</body>
	<!--方法一：js代码放在页面元素后执行-->
	<!--
	<script>
		var oBtn=document.getElementById("btn");
		console.log(oBtn);
	</script>
	-->
</html>
